using System.ComponentModel.DataAnnotations;

namespace Universal.Application.Contracts.Dto.User;

/// <summary>
/// 新增编辑用户通用DTO
/// </summary>
/// <param name="Username">用户名</param>
/// <param name="Email">邮箱</param>
/// <param name="Phone">手机号</param>
/// <param name="IsActive">是否启用</param>
/// <param name="RoleIds">角色ID集合</param>
public class AddEditUserDto
{

    [Required(ErrorMessage = "用户名不能为空")]
    public string Username { get; init; } = string.Empty;

    public string? Nickname { get; set; } = string.Empty;

    [Required(ErrorMessage = "邮箱不能为空")]
    [EmailAddress(ErrorMessage = "邮箱格式不正确")]
    public string Email { get; set; } = string.Empty;

    [Required(ErrorMessage = "手机号不能为空")]
    [RegularExpression(@"^1[3-9]\d{9}$", ErrorMessage = "请输入有效的手机号码")]
    public string Phone { get; set; } = string.Empty;

    public bool IsActive { get; set; } = true;

    public List<Guid>? RoleIds { get; set; } = null;

}